<?php
namespace app\api\controller\deerhome\shop;

use app\api\controller\deerhome\shop\Base;
use think\Db;
use app\admin\model\deerhome\Shop as ShopModel;
/**
 * 登录鉴权
*/
class BaseAuth extends Base
{

	public function __construct() {
        parent::__construct();
		if (!in_array($this->_deviceType, $this->_allowedDeviceTypes)) {
            $this->err('Unsupported devices');
        }
		if(!$this->_user){
			$this->err('登录失效，请重新进入',0,[],100);
		}
		//防止被垮号
		$id=$this->request->param("id",0,"intval");
		if($id<=0){
			return;
		}
		$shop=ShopModel::where("id",$id)->where("deerhome_user_id",$this->_user['id'])->find();
		if(!$shop){
			$this->err('您已没有该门店的权限，请切换其他门店',1);
		}
    }

}
